package com.xiaobai.data.manager.system.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaobai.data.manager.system.RoleMenuManager;
import com.xiaobai.model.entity.system.RoleMenu;
import com.xiaobai.data.mapper.system.RoleMenuMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class RoleMenuManagerImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuManager {
    @Override
    public boolean deleteMenuIds(List<Long> ids) {
        return this.remove(new LambdaQueryWrapper<RoleMenu>().in(RoleMenu::getMenuId, ids));
    }

    @Override
    public boolean deleteRoleIds(List<Long> ids) {
        return this.remove(new LambdaQueryWrapper<RoleMenu>().in(RoleMenu::getRoleId, ids));
    }

    @Override
    public List<RoleMenu> getListByRoleId(Long role) {
        return this.list(new LambdaQueryWrapper<RoleMenu>().eq(RoleMenu::getRoleId, role));
    }
}
